package maxStream;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;
import java.util.Optional;

public class Demo02 {
    public static void main(String[] args) {
        List<String> strings = Arrays.asList("aoyuan", "aoyuanao", "aoyuanaoyuan");
        Optional<String> max = strings.stream().max(Comparator.comparing(String::length));
        System.out.println("最长的字符串为" + max);
    }



}
